<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_logs', function (Blueprint $table) {
            $table->id()->comment('用户统计表');
            $table->integer('user_id')->index()->comment('用户id');
            $table->integer('city_id')->index()->comment('城市id');
            $table->integer('mer_id')->nullable()->index()->comment('商户id');
            $table->integer('visitor_num')->comment('访客数');
            $table->integer('browse_num')->comment('浏览数');
            $table->integer('register_num')->comment('新增用户数');
            $table->integer('order_num')->comment('成交用户数');
            $table->integer('recharge_num')->comment('充值用户数');
            $table->integer('list_num')->comment('客单价');
            $table->integer('user_num')->comment('累计用户');
            $table->integer('pay_num')->comment('累计付费会员数');
            $table->integer('cumulative_num')->comment('累计充值用户数');
            $table->integer('deal_num')->comment('累计成交用户数');
            $table->integer('number_num')->comment('新增付费用户数');
            $table->decimal('amount',8,2)->comment('支付金额(分)');
            $table->string('type')->comment('用户类型：officialAccount：公众号 applet:小程序  h5:H5  pc:PC  app:APP');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_logs');
    }
}
